import { lazy } from "react";

import { createBrowserRouter } from "react-router-dom";
import App from "../App";

const Home = lazy(() => import("../pages/home/Index"));
const Apply = lazy(() => import("../pages/apply/Index"));
const Login = lazy(() => import("../pages/login/Index"));
const Message = lazy(() => import("../pages/message/Index"));

const Edit = lazy(() => import("../pages/apply/edit/Index"));

export const joe = [
  {
    path: "/home/message",
    element: <Message></Message>,
    title: "首页",
  },
  {
    path: "/home/apply",
    element: <Apply></Apply>,
    title: "文档",
    children: [
      {
        path: "/home/apply/edit",
        element: <Edit></Edit>,
        title: "文档1",
      },
    ],
  },
];

const routes = createBrowserRouter([
  {
    path: "/",
    element: <App></App>,
    children: [
      {
        index: true,
        element: <Home></Home>,
      },
      {
        path: "/home",
        element: <Home></Home>,
        children: joe,
      },
    ],
  },
  {
    path: "/login",
    element: <Login></Login>,
  },
]);

export default routes;
